add terraform lambda layers sample + migrate serverless sample to new dir#238
add terraform lambda layers sample + migrate serverless sample to new dir#238HarshCasper wants to merge 3 commits intomasterfrom
Conversation
de67b78 to
5b24623
Compare
joe4dev
left a comment
There was a problem hiding this comment.
LGTM after updaing the Terraform installation and validating the Lambda invocation for CI.
Thank you for pushing this out @HarshCasper 👍
| @which awslocal || pip install awscli-local | ||
| @which terraform || (\ | ||
| echo 'Terraform was not found, installing locally' && \ | ||
| wget https://releases.hashicorp.com/terraform/1.0.8/terraform_1.0.8_linux_amd64.zip && \ |
There was a problem hiding this comment.
Outdated Terraform version and hardcoding amd64 fails on ARM machines.
https://developer.hashicorp.com/terraform/install
| output.json | ||
| cat output.json | ||
|
|
||
| run: start install package init deploy invoke |
There was a problem hiding this comment.
Consider adding some (minimal) validation step. We should at least check that the Lambda invoked successfully and did not fail for the CI to catch regressions.
| rm -rf .terraform | ||
| rf -f output.json | ||
|
|
||
| .PHONY: start install init deploy invoke clean |
There was a problem hiding this comment.
nit: incomplete missing (e.g., missing run, start, ...)
| Make sure that LocalStack is started: | ||
|
|
||
| ``` | ||
| LOCALSTACK_AUTH_TOKEN=... DEBUG=1 localstack start |
There was a problem hiding this comment.
General Idea for docs: Would it make sense to use a variable such as $LOCALSTACK_AUTH_TOKEN to facilitate copy/pasting the command rather using some bash-incompatible placeholder (e.g., ... or <>)?
| @test -e .venv || ($(PYTHON_BIN) -m venv .venv; source .venv/bin/activate; pip3 install terraform-local;) | ||
|
|
||
| package: | ||
| source .venv/bin/activate; pip install \ |
There was a problem hiding this comment.
A comment pointing to the AWS packaging docs for Python would be helpful here: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html
In particular, mention the limitation that dependencies with native dependencies require further configuration and should ideally be build using Docker.
|
|
||
| ## Prerequisites | ||
|
|
||
| * LocalStack |
There was a problem hiding this comment.
We should clarify that Layers require the Pro image here
This PR:
serverless-lambda-layerssample tolambda-layersdirectoryTODO